from flask_wtf import FlaskForm
from wtforms import StringField, SelectField, TextAreaField, EmailField
from wtforms.validators import DataRequired, Length, Email

class UserForm(FlaskForm):
    username = StringField('用户名', validators=[DataRequired(), Length(min=2, max=20)])
    email = EmailField('邮箱', validators=[DataRequired(), Email()])
    name = StringField('姓名', validators=[Length(max=64)])
    role = SelectField('角色', choices=[('user', '普通用户'), ('admin', '管理员')])
    bio = TextAreaField('个人简介') 